<?php

namespace app\load\model\haiwai;

use think\Collection;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Model;

/**
 * 海外商品表
 */
class Product extends Model
{

    protected $connection = 'haiwai';

    protected $name = 'product';

    /**
     * 列表所有商品
     * @param array $where
     * @param string $field
     * @param string $limit
     * @return array|Collection
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function  all_list(array $where = [], string $field = '*', string $limit= '10000')
    {
        return $this->db()->field($field)
            ->where($where)
            ->order('product_id desc')
            ->limit($limit)
            ->cache(true,100)
            ->select();
    }
}